package com.zzy.mybatisdemo3.mapper;

import com.zzy.mybatisdemo3.model.UserInfo;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface UserInfoMapper {

    @Select("select * from userinfo")
    List<UserInfo> queryUserList();

    @Select("select * from user where id=#{id} and age=#{age}")
    UserInfo queryUserInfo(@Param("id") Integer userid, Integer age);

    @Insert("insert into user(id,name,age) values(#{id},#{name},#{age})")
    Integer insert(UserInfo userInfo1);

    @Insert("insert into user(id,name,age) values(#{userinfo.id},#{userinfo.name},#{userinfo.age})")
    Integer insertByParam(@Param("userinfo") UserInfo userinfo1);

    @Delete("delete from user where id=#{id}")
    Integer delete(@Param("id") Integer id);

    @Update("update user set name=#{name} where id=#{id}")
    Integer update(String name,Integer id);
}
